//
//  validMove.c
//  Testat_5
//
//  Created by Benno Lauther on 21.11.13.
//
//

#include <stdio.h>
#include "coreDefines.h"


int validMove(int topOfStack, int cardToPlay, int colorWish)
{
    if(cardToPlay%NR_TYPES == JACK)
    {
        if(topOfStack%NR_TYPES != JACK)
        {
        	return 1;
        }
        else
        {
        	return 0;
        }
    }
    
    if(colorWish != NO_COLORWISH)
    {
        if(cardToPlay/NR_TYPES != colorWish)
        {
        return 0;
        }
        else
        {
            return 1;
        }
    }
    
    if(topOfStack/NR_TYPES==cardToPlay/NR_TYPES||topOfStack%NR_TYPES==cardToPlay%NR_TYPES)
        return 1;
    else
        return 0;
    
    }
